pub struct Vector2D{
    pub x: f64,
    pub y: f64,
}

//向量加法
pub fn add(self, other: Vector2D) -> Vector2d {
    Vector2D {
        x: self.x + other.x,
        y: self.y + other.y,
    }
}

//向量减法
pub fn subtract(self, other: Vector2D) -> Vector2d {
    Vector2D {
        x: self.x - other.x,
        y: self.y - other.y,
    }
}

//向量点积
pub fn dot_product(self, other: Vector2D) -> f64 {
    self.x * other.x + self.y * other.y
}
// 向量叉积
pub fn cross_product(self, other: Vector2D) -> f64 {
    self.x * other.y - self.y * other.x
}